import { configureStore } from '@reduxjs/toolkit'
import { rootReducer } from './reducer'
import { employeesApi } from '../api/employeesApi'
import { usersApi } from '../api/userApi'
import { authApi } from '../api/authApi'
import { projectsApi } from '../api/projectsApi'
import { projectManagersApi } from '../api/projectManagersApi'
import { projectEmployeeLinksApi } from '../api/projectEmployeeLinksApi'


export const store = configureStore({
  reducer: rootReducer,
  middleware: (getDefaultMiddleware) =>
      getDefaultMiddleware(
        {
          serializableCheck: false
        }
      )
        .concat(employeesApi.middleware)
        .concat(usersApi.middleware)
        .concat(authApi.middleware)
        .concat(projectsApi.middleware)
        .concat(projectManagersApi.middleware)
        .concat(projectEmployeeLinksApi.middleware)
})

export type RootState = ReturnType<typeof store.getState>
